<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="utf-8"/>
    <title>网站后台管理</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link rel="stylesheet" href="${e.res('/css/bootstrap.min.css')}">
    <link rel="stylesheet" href="${e.res('/css/font-awesome.min.css')}">
    <link rel="stylesheet" href="${e.res('/css/ace.min.css')}">
    <link rel="stylesheet" href="${e.res('/css/jquery.fancybox-1.3.4.css')}">
    <script src="${e.res('/js/jquery-1.4.3.min.js')}"></script>
    <script src="${e.res('/js/masonry.pkgd.min.js')}"></script>
    <script src="${e.res('/js/jquery.lazyload.js')}"></script>
    <script src="${e.res('/js/jquery.fancybox-1.3.4.pack.js')}"></script>
    <script src="${e.res('/js/jquery.easing-1.3.pack.js')}"></script>
    <script src="${e.res('/js/jquery.mousewheel-3.0.4.pack.js')}"></script>
    <script src="${e.res('/js/errorHander.js')}"></script>
</head>
<body>
<#include "/pages/moudle/BackHead.ftl">
<div class="main-container" id="main-container">
    <div class="main-container-inner">
    <#include "/pages/moudle/BackSideBar.ftl">
    <@backSideBar chooseTag = type />
        <!--页面主体内容-->
        <div class="main-content">
            <!-- 面包屑 -->
            <div class="breadcrumbs" id="breadcrumbs">
                <ul class="breadcrumb">
                    <li>
                        <i class="icon-home home-icon"></i>
                        <a href="/home">首页</a>
                    </li>
                    <li>
                        <a href="<#if type == '2'>/essay/list<#else>/activity/list</#if>"><#if type == '2'>随笔<#else>活动</#if>管理</a>
                    </li>
                    <li class="active"><#if type == '2'>随笔<#else>活动</#if>列表</li>
                </ul>
            </div>
            <!-- 面包屑 -->
            <div class="page-content">
                <div class="page-header">
                    <h1><#if type == '2'>随笔<#else>活动</#if>列表
                        <small>
                            <i class="icon-double-angle-right"></i>
                            已完成的<#if type == '2'>随笔<#else>活动</#if>列表
                        </small>
                    </h1>
                </div>
                <!-- /.page-header -->
                <div class="row">
                    <div class="col-xs-12">
                        <form class="form-horizontal" role="form">
                            <#include "/pages/moudle/Pagination.ftl">
                                <#if type=="2">
                                    <#assign urlList ="/essay/list">
                                <#else>
                                    <#assign urlList ="/activity/list">
                                </#if>
                            <@pagination id="essay" method=urlList page=retMap>
                            <div class="table-responsive">
                                <div id="sample-table-2_wrapper" class="dataTables_wrapper" role="grid">
                                    <table id="sample-table-2"
                                           class="table table-striped table-bordered table-hover dataTable"
                                           aria-describedby="sample-table-2_info">
                                        <thead>
                                        <tr role="row">

                                            <th class="center sorting_disabled" style="width: 128px;">标题</th>
                                            <th class="center sorting_disabled" style="width: 138px;">描述</th>
                                            <th class="center sorting_disabled" style="width: 70px;">日期</th>
                                            <th class="center sorting_disabled" style="width: 62px;">操作</th>
                                        </tr>
                                        </thead>
                                        <tbody role="alert" aria-live="polite" aria-relevant="all">
                                        <#list essayList as essay>
                                        <tr <#if essay_index % 2 == 0> class="odd"<#else>class="even"</#if>>

                                            <td class=" ">${essay.essayTitle}</td>
                                            <td class=" ">${essay.essayMiao}</td>
                                            <td class=" ">${essay.createTime}</td>
                                            <td class="center">
                                                <div essayId="${essay.prodId}"
                                                     class="visible-md visible-lg hidden-sm hidden-xs action-buttons">
                                                    <a class="green" href="#" title="编辑">
                                                        <i class="icon-pencil bigger-130"></i>
                                                    </a>
                                                    <a class="red" href="#" title="删除">
                                                        <i class="icon-trash bigger-130"></i>
                                                    </a>
                                                </div>
                                            </td>
                                        </tr>
                                        </#list>
                                        </tbody>
                                    </table>

                                    </@pagination>
                                </div>
                            </div>

                            <div class="space-4"></div>

                            <div class="clearfix form-actions">
                                <div style="float:right;">
                                    <a href="/essay/add?type=${type}" class="btn btn-info" type="button">
                                        <i class="icon-ok bigger-110"></i>
                                        新增<#if type == '2'>随笔<#else>活动</#if>
                                    </a>
                                </div>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
        <!--页面主题内容结束-->
    </div>
</div>

</body>

<script>
    $(".red").click(function () {

        if (confirm('确定要删除此条吗?')) {
            var essayid = $(this).parent().attr("essayId");
            window.location.href = "deleteEssay?prodId=" + essayid + "&type=" + ${type};
            return true;
        }
        return false;
    })

    $(".green").click(function () {
        var essayid = $(this).parent().attr("essayId");
        window.location.href = "editEssay?prodId=" + essayid;
    })
</script>
</html>